/**
 * @author : xiaozhuai
 * @date   : 17/3/20
 */

#include "MimeType.h"

MimeType MimeType::instance;

string MimeType::fromExtension(string ext) {
    ltrim(ext, '.');
    ext = "." + ext;
    return (map.find(ext) != map.end()) ? map[ext] : map[".*"];
}

MimeType::MimeType() {
    insert(".ez", "application/andrew-inset");
    insert(".aw", "application/applixware");
    insert(".atom", "application/atom+xml");
    insert(".atomcat", "application/atomcat+xml");
    insert(".atomsvc", "application/atomsvc+xml");
    insert(".ccxml", "application/ccxml+xml");
    insert(".cu", "application/cu-seeme");
    insert(".davmount", "application/davmount+xml");
    insert(".ecma", "application/ecmascript");
    insert(".emma", "application/emma+xml");
    insert(".epub", "application/epub+zip");
    insert(".pfr", "application/font-tdpfr");
    insert(".stk", "application/hyperstudio");
    insert(".jar", "application/java-archive");
    insert(".ser", "application/java-serialized-object");
    insert(".class", "application/java-vm");
    insert(".js", "application/javascript");
    insert(".json", "application/json");
    insert(".lostxml", "application/lost+xml");
    insert(".hqx", "application/mac-binhex40");
    insert(".cpt", "application/mac-compactpro");
    insert(".mrc", "application/marc");
    insert(".ma,.nb,.mb", "application/mathematica");
    insert(".mathml", "application/mathml+xml");
    insert(".mbox", "application/mbox");
    insert(".mscml", "application/mediaservercontrol+xml");
    insert(".mp4s", "application/mp4");
    insert(".doc,.dot", "application/msword");
    insert(".mxf", "application/mxf");
    insert(".oda", "application/oda");
    insert(".opf", "application/oebps-package+xml");
    insert(".ogx", "application/ogg");
    insert(".onetoc,.onetoc2,.onetmp,.onepkg", "application/onenote");
    insert(".xer", "application/patch-ops-error+xml");
    insert(".pdf", "application/pdf");
    insert(".pgp", "application/pgp-encrypted");
    insert(".asc,.sig", "application/pgp-signature");
    insert(".prf", "application/pics-rules");
    insert(".p10", "application/pkcs10");
    insert(".p7m,.p7c", "application/pkcs7-mime");
    insert(".p7s", "application/pkcs7-signature");
    insert(".cer", "application/pkix-cert");
    insert(".crl", "application/pkix-crl");
    insert(".pkipath", "application/pkix-pkipath");
    insert(".pki", "application/pkixcmp");
    insert(".pls", "application/pls+xml");
    insert(".ai,.eps,.ps", "application/postscript");
    insert(".cww", "application/prs.cww");
    insert(".rdf", "application/rdf+xml");
    insert(".rif", "application/reginfo+xml");
    insert(".rnc", "application/relax-ng-compact-syntax");
    insert(".rl", "application/resource-lists+xml");
    insert(".rld", "application/resource-lists-diff+xml");
    insert(".rs", "application/rls-services+xml");
    insert(".rsd", "application/rsd+xml");
    insert(".rss", "application/rss+xml");
    insert(".rtf", "application/rtf");
    insert(".sbml", "application/sbml+xml");
    insert(".scq", "application/scvp-cv-request");
    insert(".scs", "application/scvp-cv-response");
    insert(".spq", "application/scvp-vp-request");
    insert(".spp", "application/scvp-vp-response");
    insert(".sdp", "application/sdp");
    insert(".setpay", "application/set-payment-initiation");
    insert(".setreg", "application/set-registration-initiation");
    insert(".shf", "application/shf+xml");
    insert(".smi,.smil", "application/smil+xml");
    insert(".rq", "application/sparql-query");
    insert(".srx", "application/sparql-results+xml");
    insert(".gram", "application/srgs");
    insert(".grxml", "application/srgs+xml");
    insert(".ssml", "application/ssml+xml");
    insert(".plb", "application/vnd.3gpp.pic-bw-large");
    insert(".psb", "application/vnd.3gpp.pic-bw-small");
    insert(".pvb", "application/vnd.3gpp.pic-bw-var");
    insert(".tcap", "application/vnd.3gpp2.tcap");
    insert(".pwn", "application/vnd.3m.post-it-notes");
    insert(".aso", "application/vnd.accpac.simply.aso");
    insert(".imp", "application/vnd.accpac.simply.imp");
    insert(".acu", "application/vnd.acucobol");
    insert(".atc,.acutc", "application/vnd.acucorp");
    insert(".air", "application/vnd.adobe.air-application-installer-package+zip");
    insert(".xdp", "application/vnd.adobe.xdp+xml");
    insert(".xfdf", "application/vnd.adobe.xfdf");
    insert(".azf", "application/vnd.airzip.filesecure.azf");
    insert(".azs", "application/vnd.airzip.filesecure.azs");
    insert(".azw", "application/vnd.amazon.ebook");
    insert(".acc", "application/vnd.americandynamics.acc");
    insert(".ami", "application/vnd.amiga.ami");
    insert(".apk", "application/vnd.android.package-archive");
    insert(".cii", "application/vnd.anser-web-certificate-issue-initiation");
    insert(".fti", "application/vnd.anser-web-funds-transfer-initiation");
    insert(".atx", "application/vnd.antix.game-component");
    insert(".mpkg", "application/vnd.apple.installer+xml");
    insert(".swi", "application/vnd.arastra.swi");
    insert(".aep", "application/vnd.audiograph");
    insert(".mpm", "application/vnd.blueice.multipass");
    insert(".bmi", "application/vnd.bmi");
    insert(".rep", "application/vnd.businessobjects");
    insert(".cdxml", "application/vnd.chemdraw+xml");
    insert(".mmd", "application/vnd.chipnuts.karaoke-mmd");
    insert(".cdy", "application/vnd.cinderella");
    insert(".cla", "application/vnd.claymore");
    insert(".c4g,.c4d,.c4f,.c4p,.c4u", "application/vnd.clonk.c4group");
    insert(".csp", "application/vnd.commonspace");
    insert(".cdbcmsg", "application/vnd.contact.cmsg");
    insert(".cmc", "application/vnd.cosmocaller");
    insert(".clkx", "application/vnd.crick.clicker");
    insert(".clkk", "application/vnd.crick.clicker.keyboard");
    insert(".clkp", "application/vnd.crick.clicker.palette");
    insert(".clkt", "application/vnd.crick.clicker.template");
    insert(".clkw", "application/vnd.crick.clicker.wordbank");
    insert(".wbs", "application/vnd.criticaltools.wbs+xml");
    insert(".pml", "application/vnd.ctc-posml");
    insert(".ppd", "application/vnd.cups-ppd");
    insert(".car", "application/vnd.curl.car");
    insert(".pcurl", "application/vnd.curl.pcurl");
    insert(".rdz", "application/vnd.data-vision.rdz");
    insert(".fe_launch", "application/vnd.denovo.fcselayout-link");
    insert(".dna", "application/vnd.dna");
    insert(".mlp", "application/vnd.dolby.mlp");
    insert(".dpg", "application/vnd.dpgraph");
    insert(".dfac", "application/vnd.dreamfactory");
    insert(".geo", "application/vnd.dynageo");
    insert(".mag", "application/vnd.ecowin.chart");
    insert(".nml", "application/vnd.enliven");
    insert(".esf", "application/vnd.epson.esf");
    insert(".msf", "application/vnd.epson.msf");
    insert(".qam", "application/vnd.epson.quickanime");
    insert(".slt", "application/vnd.epson.salt");
    insert(".ssf", "application/vnd.epson.ssf");
    insert(".es3,.et3", "application/vnd.eszigno3+xml");
    insert(".ez2", "application/vnd.ezpix-album");
    insert(".ez3", "application/vnd.ezpix-package");
    insert(".fdf", "application/vnd.fdf");
    insert(".mseed", "application/vnd.fdsn.mseed");
    insert(".seed,.dataless", "application/vnd.fdsn.seed");
    insert(".gph", "application/vnd.flographit");
    insert(".ftc", "application/vnd.fluxtime.clip");
    insert(".fm,.frame,.maker,.book", "application/vnd.framemaker");
    insert(".fnc", "application/vnd.frogans.fnc");
    insert(".ltf", "application/vnd.frogans.ltf");
    insert(".fsc", "application/vnd.fsc.weblaunch");
    insert(".oas", "application/vnd.fujitsu.oasys");
    insert(".oa2", "application/vnd.fujitsu.oasys2");
    insert(".oa3", "application/vnd.fujitsu.oasys3");
    insert(".fg5", "application/vnd.fujitsu.oasysgp");
    insert(".bh2", "application/vnd.fujitsu.oasysprs");
    insert(".ddd", "application/vnd.fujixerox.ddd");
    insert(".xdw", "application/vnd.fujixerox.docuworks");
    insert(".xbd", "application/vnd.fujixerox.docuworks.binder");
    insert(".fzs", "application/vnd.fuzzysheet");
    insert(".txd", "application/vnd.genomatix.tuxedo");
    insert(".ggb", "application/vnd.geogebra.file");
    insert(".ggt", "application/vnd.geogebra.tool");
    insert(".gex,.gre", "application/vnd.geometry-explorer");
    insert(".gmx", "application/vnd.gmx");
    insert(".kml", "application/vnd.google-earth.kml+xml");
    insert(".kmz", "application/vnd.google-earth.kmz");
    insert(".gqf,.gqs", "application/vnd.grafeq");
    insert(".gac", "application/vnd.groove-account");
    insert(".ghf", "application/vnd.groove-help");
    insert(".gim", "application/vnd.groove-identity-message");
    insert(".grv", "application/vnd.groove-injector");
    insert(".gtm", "application/vnd.groove-tool-message");
    insert(".tpl", "application/vnd.groove-tool-template");
    insert(".vcg", "application/vnd.groove-vcard");
    insert(".zmm", "application/vnd.handheld-entertainment+xml");
    insert(".hbci", "application/vnd.hbci");
    insert(".les", "application/vnd.hhe.lesson-player");
    insert(".hpgl", "application/vnd.hp-hpgl");
    insert(".hpid", "application/vnd.hp-hpid");
    insert(".hps", "application/vnd.hp-hps");
    insert(".jlt", "application/vnd.hp-jlyt");
    insert(".pcl", "application/vnd.hp-pcl");
    insert(".pclxl", "application/vnd.hp-pclxl");
    insert(".sfd-hdstx", "application/vnd.hydrostatix.sof-data");
    insert(".x3d", "application/vnd.hzn-3d-crossword");
    insert(".mpy", "application/vnd.ibm.minipay");
    insert(".afp,.listafp,.list3820", "application/vnd.ibm.modcap");
    insert(".irm", "application/vnd.ibm.rights-management");
    insert(".sc", "application/vnd.ibm.secure-container");
    insert(".icc,.icm", "application/vnd.iccprofile");
    insert(".igl", "application/vnd.igloader");
    insert(".ivp", "application/vnd.immervision-ivp");
    insert(".ivu", "application/vnd.immervision-ivu");
    insert(".xpw,.xpx", "application/vnd.intercon.formnet");
    insert(".qbo", "application/vnd.intu.qbo");
    insert(".qfx", "application/vnd.intu.qfx");
    insert(".rcprofile", "application/vnd.ipunplugged.rcprofile");
    insert(".irp", "application/vnd.irepository.package+xml");
    insert(".xpr", "application/vnd.is-xpr");
    insert(".jam", "application/vnd.jam");
    insert(".rms", "application/vnd.jcp.javame.midlet-rms");
    insert(".jisp", "application/vnd.jisp");
    insert(".joda", "application/vnd.joost.joda-archive");
    insert(".ktz,.ktr", "application/vnd.kahootz");
    insert(".karbon", "application/vnd.kde.karbon");
    insert(".chrt", "application/vnd.kde.kchart");
    insert(".kfo", "application/vnd.kde.kformula");
    insert(".flw", "application/vnd.kde.kivio");
    insert(".kon", "application/vnd.kde.kontour");
    insert(".kpr,.kpt", "application/vnd.kde.kpresenter");
    insert(".ksp", "application/vnd.kde.kspread");
    insert(".kwd,.kwt", "application/vnd.kde.kword");
    insert(".htke", "application/vnd.kenameaapp");
    insert(".kia", "application/vnd.kidspiration");
    insert(".kne,.knp", "application/vnd.kinar");
    insert(".skp,.skd,.skt,.skm", "application/vnd.koan");
    insert(".sse", "application/vnd.kodak-descriptor");
    insert(".lbd", "application/vnd.llamagraphics.life-balance.desktop");
    insert(".lbe", "application/vnd.llamagraphics.life-balance.exchange+xml");
    insert(".123", "application/vnd.lotus-1-2-3");
    insert(".apr", "application/vnd.lotus-approach");
    insert(".pre", "application/vnd.lotus-freelance");
    insert(".nsf", "application/vnd.lotus-notes");
    insert(".org", "application/vnd.lotus-organizer");
    insert(".scm", "application/vnd.lotus-screencam");
    insert(".lwp", "application/vnd.lotus-wordpro");
    insert(".portpkg", "application/vnd.macports.portpkg");
    insert(".mcd", "application/vnd.mcd");
    insert(".mc1", "application/vnd.medcalcdata");
    insert(".cdkey", "application/vnd.mediastation.cdkey");
    insert(".mwf", "application/vnd.mfer");
    insert(".mfm", "application/vnd.mfmp");
    insert(".flo", "application/vnd.micrografx.flo");
    insert(".igx", "application/vnd.micrografx.igx");
    insert(".mif", "application/vnd.mif");
    insert(".daf", "application/vnd.mobius.daf");
    insert(".dis", "application/vnd.mobius.dis");
    insert(".mbk", "application/vnd.mobius.mbk");
    insert(".mqy", "application/vnd.mobius.mqy");
    insert(".msl", "application/vnd.mobius.msl");
    insert(".plc", "application/vnd.mobius.plc");
    insert(".txf", "application/vnd.mobius.txf");
    insert(".mpn", "application/vnd.mophun.application");
    insert(".mpc", "application/vnd.mophun.certificate");
    insert(".xul", "application/vnd.mozilla.xul+xml");
    insert(".cil", "application/vnd.ms-artgalry");
    insert(".cab", "application/vnd.ms-cab-compressed");
    insert(".xls,.xlm,.xla,.xlc,.xlt,.xlw", "application/vnd.ms-excel");
    insert(".xlam", "application/vnd.ms-excel.addin.macroenabled.12");
    insert(".xlsb", "application/vnd.ms-excel.sheet.binary.macroenabled.12");
    insert(".xlsm", "application/vnd.ms-excel.sheet.macroenabled.12");
    insert(".xltm", "application/vnd.ms-excel.template.macroenabled.12");
    insert(".eot", "application/vnd.ms-fontobject");
    insert(".chm", "application/vnd.ms-htmlhelp");
    insert(".ims", "application/vnd.ms-ims");
    insert(".lrm", "application/vnd.ms-lrm");
    insert(".cat", "application/vnd.ms-pki.seccat");
    insert(".stl", "application/vnd.ms-pki.stl");
    insert(".ppt,.pps,.pot", "application/vnd.ms-powerpoint");
    insert(".ppam", "application/vnd.ms-powerpoint.addin.macroenabled.12");
    insert(".pptm", "application/vnd.ms-powerpoint.presentation.macroenabled.12");
    insert(".sldm", "application/vnd.ms-powerpoint.slide.macroenabled.12");
    insert(".ppsm", "application/vnd.ms-powerpoint.slideshow.macroenabled.12");
    insert(".potm", "application/vnd.ms-powerpoint.template.macroenabled.12");
    insert(".mpp,.mpt", "application/vnd.ms-project");
    insert(".docm", "application/vnd.ms-word.document.macroenabled.12");
    insert(".dotm", "application/vnd.ms-word.template.macroenabled.12");
    insert(".wps,.wks,.wcm,.wdb", "application/vnd.ms-works");
    insert(".wpl", "application/vnd.ms-wpl");
    insert(".xps", "application/vnd.ms-xpsdocument");
    insert(".mseq", "application/vnd.mseq");
    insert(".mus", "application/vnd.musician");
    insert(".msty", "application/vnd.muvee.style");
    insert(".nlu", "application/vnd.neurolanguage.nlu");
    insert(".nnd", "application/vnd.noblenet-directory");
    insert(".nns", "application/vnd.noblenet-sealer");
    insert(".nnw", "application/vnd.noblenet-web");
    insert(".ngdat", "application/vnd.nokia.n-gage.data");
    insert(".n-gage", "application/vnd.nokia.n-gage.symbian.install");
    insert(".rpst", "application/vnd.nokia.radio-preset");
    insert(".rpss", "application/vnd.nokia.radio-presets");
    insert(".edm", "application/vnd.novadigm.edm");
    insert(".edx", "application/vnd.novadigm.edx");
    insert(".ext", "application/vnd.novadigm.ext");
    insert(".odc", "application/vnd.oasis.opendocument.chart");
    insert(".otc", "application/vnd.oasis.opendocument.chart-template");
    insert(".odb", "application/vnd.oasis.opendocument.database");
    insert(".odf", "application/vnd.oasis.opendocument.formula");
    insert(".odft", "application/vnd.oasis.opendocument.formula-template");
    insert(".odg", "application/vnd.oasis.opendocument.graphics");
    insert(".otg", "application/vnd.oasis.opendocument.graphics-template");
    insert(".odi", "application/vnd.oasis.opendocument.image");
    insert(".oti", "application/vnd.oasis.opendocument.image-template");
    insert(".odp", "application/vnd.oasis.opendocument.presentation");
    insert(".ods", "application/vnd.oasis.opendocument.spreadsheet");
    insert(".ots", "application/vnd.oasis.opendocument.spreadsheet-template");
    insert(".odt", "application/vnd.oasis.opendocument.text");
    insert(".otm", "application/vnd.oasis.opendocument.text-master");
    insert(".ott", "application/vnd.oasis.opendocument.text-template");
    insert(".oth", "application/vnd.oasis.opendocument.text-web");
    insert(".xo", "application/vnd.olpc-sugar");
    insert(".dd2", "application/vnd.oma.dd2+xml");
    insert(".oxt", "application/vnd.openofficeorg.extension");
    insert(".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
    insert(".sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide");
    insert(".ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow");
    insert(".potx", "application/vnd.openxmlformats-officedocument.presentationml.template");
    insert(".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
    insert(".xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template");
    insert(".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
    insert(".dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template");
    insert(".dp", "application/vnd.osgi.dp");
    insert(".pdb,.pqa,.oprc", "application/vnd.palm");
    insert(".str", "application/vnd.pg.format");
    insert(".ei6", "application/vnd.pg.osasli");
    insert(".efif", "application/vnd.picsel");
    insert(".plf", "application/vnd.pocketlearn");
    insert(".pbd", "application/vnd.powerbuilder6");
    insert(".box", "application/vnd.previewsystems.box");
    insert(".mgz", "application/vnd.proteus.magazine");
    insert(".qps", "application/vnd.publishare-delta-tree");
    insert(".ptid", "application/vnd.pvi.ptid1");
    insert(".qxd,.qxt,.qwd,.qwt,.qxl,.qxb", "application/vnd.quark.quarkxpress");
    insert(".mxl", "application/vnd.recordare.musicxml");
    insert(".musicxml", "application/vnd.recordare.musicxml+xml");
    insert(".cod", "application/vnd.rim.cod");
    insert(".rm", "application/vnd.rn-realmedia");
    insert(".link66", "application/vnd.route66.link66+xml");
    insert(".see", "application/vnd.seemail");
    insert(".sema", "application/vnd.sema");
    insert(".semd", "application/vnd.semd");
    insert(".semf", "application/vnd.semf");
    insert(".ifm", "application/vnd.shana.informed.formdata");
    insert(".itp", "application/vnd.shana.informed.formtemplate");
    insert(".iif", "application/vnd.shana.informed.interchange");
    insert(".ipk", "application/vnd.shana.informed.package");
    insert(".twd,.twds", "application/vnd.simtech-mindmapper");
    insert(".mmf", "application/vnd.smaf");
    insert(".teacher", "application/vnd.smart.teacher");
    insert(".sdkm,.sdkd", "application/vnd.solent.sdkm+xml");
    insert(".dxp", "application/vnd.spotfire.dxp");
    insert(".sfs", "application/vnd.spotfire.sfs");
    insert(".sdc", "application/vnd.stardivision.calc");
    insert(".sda", "application/vnd.stardivision.draw");
    insert(".sdd", "application/vnd.stardivision.impress");
    insert(".smf", "application/vnd.stardivision.math");
    insert(".sdw", "application/vnd.stardivision.writer");
    insert(".vor", "application/vnd.stardivision.writer");
    insert(".sgl", "application/vnd.stardivision.writer-global");
    insert(".sxc", "application/vnd.sun.xml.calc");
    insert(".stc", "application/vnd.sun.xml.calc.template");
    insert(".sxd", "application/vnd.sun.xml.draw");
    insert(".std", "application/vnd.sun.xml.draw.template");
    insert(".sxi", "application/vnd.sun.xml.impress");
    insert(".sti", "application/vnd.sun.xml.impress.template");
    insert(".sxm", "application/vnd.sun.xml.math");
    insert(".sxw", "application/vnd.sun.xml.writer");
    insert(".sxg", "application/vnd.sun.xml.writer.global");
    insert(".stw", "application/vnd.sun.xml.writer.template");
    insert(".sus,.susp", "application/vnd.sus-calendar");
    insert(".svd", "application/vnd.svd");
    insert(".sis,.sisx", "application/vnd.symbian.install");
    insert(".xsm", "application/vnd.syncml+xml");
    insert(".bdm", "application/vnd.syncml.dm+wbxml");
    insert(".xdm", "application/vnd.syncml.dm+xml");
    insert(".tao", "application/vnd.tao.intent-module-archive");
    insert(".tmo", "application/vnd.tmobile-livetv");
    insert(".tpt", "application/vnd.trid.tpt");
    insert(".mxs", "application/vnd.triscape.mxs");
    insert(".tra", "application/vnd.trueapp");
    insert(".ufd,.ufdl", "application/vnd.ufdl");
    insert(".utz", "application/vnd.uiq.theme");
    insert(".umj", "application/vnd.umajin");
    insert(".unityweb", "application/vnd.unity");
    insert(".uoml", "application/vnd.uoml+xml");
    insert(".vcx", "application/vnd.vcx");
    insert(".vsd,.vst,.vss,.vsw", "application/vnd.visio");
    insert(".vis", "application/vnd.visionary");
    insert(".vsf", "application/vnd.vsf");
    insert(".wbxml", "application/vnd.wap.wbxml");
    insert(".wmlc", "application/vnd.wap.wmlc");
    insert(".wmlsc", "application/vnd.wap.wmlscriptc");
    insert(".wtb", "application/vnd.webturbo");
    insert(".wpd", "application/vnd.wordperfect");
    insert(".wqd", "application/vnd.wqd");
    insert(".stf", "application/vnd.wt.stf");
    insert(".xar", "application/vnd.xara");
    insert(".xfdl", "application/vnd.xfdl");
    insert(".hvd", "application/vnd.yamaha.hv-dic");
    insert(".hvs", "application/vnd.yamaha.hv-script");
    insert(".hvp", "application/vnd.yamaha.hv-voice");
    insert(".osf", "application/vnd.yamaha.openscoreformat");
    insert(".osfpvg", "application/vnd.yamaha.openscoreformat.osfpvg+xml");
    insert(".saf", "application/vnd.yamaha.smaf-audio");
    insert(".spf", "application/vnd.yamaha.smaf-phrase");
    insert(".cmp", "application/vnd.yellowriver-custom-menu");
    insert(".zir,.zirz", "application/vnd.zul");
    insert(".zaz", "application/vnd.zzazz.deck+xml");
    insert(".vxml", "application/voicexml+xml");
    insert(".hlp", "application/winhlp");
    insert(".wsdl", "application/wsdl+xml");
    insert(".wspolicy", "application/wspolicy+xml");
    insert(".abw", "application/x-abiword");
    insert(".ace", "application/x-ace-compressed");
    insert(".aab,.x32,.u32,.vox", "application/x-authorware-bin");
    insert(".aam", "application/x-authorware-map");
    insert(".aas", "application/x-authorware-seg");
    insert(".bcpio", "application/x-bcpio");
    insert(".torrent", "application/x-bittorrent");
    insert(".bz", "application/x-bzip");
    insert(".bz2,.boz", "application/x-bzip2");
    insert(".vcd", "application/x-cdlink");
    insert(".chat", "application/x-chat");
    insert(".pgn", "application/x-chess-pgn");
    insert(".cpio", "application/x-cpio");
    insert(".csh", "application/x-csh");
    insert(".deb,.udeb", "application/x-debian-package");
    insert(".dir,.dcr,.dxr,.cst,.cct,.cxt,.w3d,.fgd,.swa", "application/x-director");
    insert(".wad", "application/x-doom");
    insert(".ncx", "application/x-dtbncx+xml");
    insert(".dtb", "application/x-dtbook+xml");
    insert(".res", "application/x-dtbresource+xml");
    insert(".dvi", "application/x-dvi");
    insert(".bdf", "application/x-font-bdf");
    insert(".gsf", "application/x-font-ghostscript");
    insert(".psf", "application/x-font-linux-psf");
    insert(".otf", "application/x-font-otf");
    insert(".pcf", "application/x-font-pcf");
    insert(".snf", "application/x-font-snf");
    insert(".ttf,.ttc", "application/x-font-ttf");
    insert(".woff", "application/font-woff");
    insert(".pfa,.pfb,.pfm,.afm", "application/x-font-type1");
    insert(".spl", "application/x-futuresplash");
    insert(".gnumeric", "application/x-gnumeric");
    insert(".gtar", "application/x-gtar");
    insert(".hdf", "application/x-hdf");
    insert(".jnlp", "application/x-java-jnlp-file");
    insert(".latex", "application/x-latex");
    insert(".prc,.mobi", "application/x-mobipocket-ebook");
    insert(".application", "application/x-ms-application");
    insert(".wmd", "application/x-ms-wmd");
    insert(".wmz", "application/x-ms-wmz");
    insert(".xbap", "application/x-ms-xbap");
    insert(".mdb", "application/x-msaccess");
    insert(".obd", "application/x-msbinder");
    insert(".crd", "application/x-mscardfile");
    insert(".clp", "application/x-msclip");
    insert(".exe,.dll,.com,.bat,.msi", "application/x-msdownload");
    insert(".mvb,.m13,.m14", "application/x-msmediaview");
    insert(".wmf", "application/x-msmetafile");
    insert(".mny", "application/x-msmoney");
    insert(".pub", "application/x-mspublisher");
    insert(".scd", "application/x-msschedule");
    insert(".trm", "application/x-msterminal");
    insert(".wri", "application/x-mswrite");
    insert(".nc,.cdf", "application/x-netcdf");
    insert(".p12,.pfx", "application/x-pkcs12");
    insert(".p7b,.spc", "application/x-pkcs7-certificates");
    insert(".p7r", "application/x-pkcs7-certreqresp");
    insert(".rar", "application/x-rar-compressed");
    insert(".sh", "application/x-sh");
    insert(".shar", "application/x-shar");
    insert(".swf", "application/x-shockwave-flash");
    insert(".xap", "application/x-silverlight-app");
    insert(".sit", "application/x-stuffit");
    insert(".sitx", "application/x-stuffitx");
    insert(".sv4cpio", "application/x-sv4cpio");
    insert(".sv4crc", "application/x-sv4crc");
    insert(".tar", "application/x-tar");
    insert(".tcl", "application/x-tcl");
    insert(".tex", "application/x-tex");
    insert(".tfm", "application/x-tex-tfm");
    insert(".texinfo,.texi", "application/x-texinfo");
    insert(".ustar", "application/x-ustar");
    insert(".src", "application/x-wais-source");
    insert(".der,.crt", "application/x-x509-ca-cert");
    insert(".fig", "application/x-xfig");
    insert(".xpi", "application/x-xpinstall");
    insert(".xenc", "application/xenc+xml");
    insert(".xhtml,.xht", "application/xhtml+xml");
    insert(".xml,.xsl", "application/xml");
    insert(".dtd", "application/xml-dtd");
    insert(".xop", "application/xop+xml");
    insert(".xslt", "application/xslt+xml");
    insert(".xspf", "application/xspf+xml");
    insert(".mxml,.xhvml,.xvml,.xvm", "application/xv+xml");
    insert(".zip", "application/zip");
    insert(".adp", "audio/adpcm");
    insert(".au,.snd", "audio/basic");
    insert(".mid,.midi,.kar,.rmi", "audio/midi");
    insert(".mp4a", "audio/mp4");
    insert(".m4a,.m4p", "audio/mp4a-latm");
    insert(".mpga,.mp2,.mp2a,.mp3,.m2a,.m3a", "audio/mpeg");
    insert(".oga,.ogg,.spx", "audio/ogg");
    insert(".eol", "audio/vnd.digital-winds");
    insert(".dts", "audio/vnd.dts");
    insert(".dtshd", "audio/vnd.dts.hd");
    insert(".lvp", "audio/vnd.lucent.voice");
    insert(".pya", "audio/vnd.ms-playready.media.pya");
    insert(".ecelp4800", "audio/vnd.nuera.ecelp4800");
    insert(".ecelp7470", "audio/vnd.nuera.ecelp7470");
    insert(".ecelp9600", "audio/vnd.nuera.ecelp9600");
    insert(".aac", "audio/x-aac");
    insert(".aif,.aiff,.aifc", "audio/x-aiff");
    insert(".m3u", "audio/x-mpegurl");
    insert(".wax", "audio/x-ms-wax");
    insert(".wma", "audio/x-ms-wma");
    insert(".ram,.ra", "audio/x-pn-realaudio");
    insert(".rmp", "audio/x-pn-realaudio-plugin");
    insert(".wav", "audio/x-wav");
    insert(".cdx", "chemical/x-cdx");
    insert(".cif", "chemical/x-cif");
    insert(".cmdf", "chemical/x-cmdf");
    insert(".cml", "chemical/x-cml");
    insert(".csml", "chemical/x-csml");
    insert(".xyz", "chemical/x-xyz");
    insert(".bmp", "image/bmp");
    insert(".cgm", "image/cgm");
    insert(".g3", "image/g3fax");
    insert(".gif", "image/gif");
    insert(".ief", "image/ief");
    insert(".jp2", "image/jp2");
    insert(".jpeg,.jpg,.jpe", "image/jpeg");
    insert(".pict,.pic,.pct", "image/pict");
    insert(".png", "image/png");
    insert(".btif", "image/prs.btif");
    insert(".svg,.svgz", "image/svg+xml");
    insert(".tiff,.tif", "image/tiff");
    insert(".psd", "image/vnd.adobe.photoshop");
    insert(".djvu,.djv", "image/vnd.djvu");
    insert(".dwg", "image/vnd.dwg");
    insert(".dxf", "image/vnd.dxf");
    insert(".fbs", "image/vnd.fastbidsheet");
    insert(".fpx", "image/vnd.fpx");
    insert(".fst", "image/vnd.fst");
    insert(".mmr", "image/vnd.fujixerox.edmics-mmr");
    insert(".rlc", "image/vnd.fujixerox.edmics-rlc");
    insert(".mdi", "image/vnd.ms-modi");
    insert(".npx", "image/vnd.net-fpx");
    insert(".wbmp", "image/vnd.wap.wbmp");
    insert(".xif", "image/vnd.xiff");
    insert(".ras", "image/x-cmu-raster");
    insert(".cmx", "image/x-cmx");
    insert(".fh,.fhc,.fh4,.fh5,.fh7", "image/x-freehand");
    insert(".ico", "image/x-icon");
    insert(".pntg,.pnt,.mac", "image/x-macpaint");
    insert(".pcx", "image/x-pcx");
    insert(".pnm", "image/x-portable-anymap");
    insert(".pbm", "image/x-portable-bitmap");
    insert(".pgm", "image/x-portable-graymap");
    insert(".ppm", "image/x-portable-pixmap");
    insert(".qtif,.qti", "image/x-quicktime");
    insert(".rgb", "image/x-rgb");
    insert(".xbm", "image/x-xbitmap");
    insert(".xpm", "image/x-xpixmap");
    insert(".xwd", "image/x-xwindowdump");
    insert(".eml,.mime", "message/rfc822");
    insert(".igs,.iges", "model/iges");
    insert(".msh,.mesh,.silo", "model/mesh");
    insert(".dwf", "model/vnd.dwf");
    insert(".gdl", "model/vnd.gdl");
    insert(".gtw", "model/vnd.gtw");
    insert(".mts", "model/vnd.mts");
    insert(".vtu", "model/vnd.vtu");
    insert(".wrl,.vrml", "model/vrml");
    insert(".ics,.ifb", "text/calendar");
    insert(".css", "text/css");
    insert(".csv", "text/csv");
    insert(".html,.htm", "text/html");
    insert(".txt,.text,.conf,.def,.list,.log,.in,.ini", "text/plain");
    insert(".dsc", "text/prs.lines.tag");
    insert(".rtx", "text/richtext");
    insert(".sgml,.sgm", "text/sgml");
    insert(".tsv", "text/tab-separated-values");
    insert(".t,.tr,.roff,.man,.me,.ms", "text/troff");
    insert(".uri,.uris,.urls", "text/uri-list");
    insert(".curl", "text/vnd.curl");
    insert(".dcurl", "text/vnd.curl.dcurl");
    insert(".scurl", "text/vnd.curl.scurl");
    insert(".mcurl", "text/vnd.curl.mcurl");
    insert(".fly", "text/vnd.fly");
    insert(".flx", "text/vnd.fmi.flexstor");
    insert(".gv", "text/vnd.graphviz");
    insert(".3dml", "text/vnd.in3d.3dml");
    insert(".spot", "text/vnd.in3d.spot");
    insert(".jad", "text/vnd.sun.j2me.app-descriptor");
    insert(".wml", "text/vnd.wap.wml");
    insert(".wmls", "text/vnd.wap.wmlscript");
    insert(".s,.asm", "text/x-asm");
    insert(".c,.cc,.cxx,.cpp,.h,.hh,.dic", "text/x-c");
    insert(".f,.for,.f77,.f90", "text/x-fortran");
    insert(".p,.pas", "text/x-pascal");
    insert(".java", "text/x-java-source");
    insert(".etx", "text/x-setext");
    insert(".uu", "text/x-uuencode");
    insert(".vcs", "text/x-vcalendar");
    insert(".vcf", "text/x-vcard");
    insert(".3gp", "video/3gpp");
    insert(".3g2", "video/3gpp2");
    insert(".h261", "video/h261");
    insert(".h263", "video/h263");
    insert(".h264", "video/h264");
    insert(".jpgv", "video/jpeg");
    insert(".jpm,.jpgm", "video/jpm");
    insert(".mj2,.mjp2", "video/mj2");
    insert(".mp4,.mp4v,.mpg4,.m4v", "video/mp4");
    insert(".webm", "video/webm");
    insert(".mpeg,.mpg,.mpe,.m1v,.m2v", "video/mpeg");
    insert(".ogv", "video/ogg");
    insert(".qt,.mov", "video/quicktime");
    insert(".fvt", "video/vnd.fvt");
    insert(".mxu,.m4u", "video/vnd.mpegurl");
    insert(".pyv", "video/vnd.ms-playready.media.pyv");
    insert(".viv", "video/vnd.vivo");
    insert(".dv,.dif", "video/x-dv");
    insert(".f4v", "video/x-f4v");
    insert(".fli", "video/x-fli");
    insert(".flv", "video/x-flv");
    insert(".asf,.asx", "video/x-ms-asf");
    insert(".wm", "video/x-ms-wm");
    insert(".wmv", "video/x-ms-wmv");
    insert(".wmx", "video/x-ms-wmx");
    insert(".wvx", "video/x-ms-wvx");
    insert(".avi", "video/x-msvideo");
    insert(".movie", "video/x-sgi-movie");
    insert(".ice", "x-conference/x-cooltalk");
    insert(".indd", "application/x-indesign");
    insert(".dat,.*", "application/octet-stream");
}

void MimeType::insert(string exts, string mimetype) {
    vector<string> extVector = StringUtils::split(exts, ",");
    for(int i=0; i<extVector.size(); i++){
        map[extVector[i]] = mimetype;
    }
}